﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Linq;

namespace CMTVision.Widgets.Modules
{
    public partial class WidgetList : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }


        public string WidgetRepositoryCSS
        {
            get;
            set;
        }


        protected void WidgetRepeater_Load(object sender, EventArgs e)
        {
            Repeater widgetRepeater = (Repeater)sender;
            widgetRepeater.DataSource = (from ele in XDocument.Load(Server.MapPath("~/Data/widgets.xml")).Element("widgets").Elements("widget")
                                         select new
                                         {
                                             Title = ele.Element("title").Value,
                                             ID = ele.Element("id").Value
                                         }
                                        ).ToList();
            widgetRepeater.DataBind();
        }
    }
}